/**
 * Licensee: DuKe TeAm
 * License Type: Purchased
 */
package ormsamples;

import org.orm.*;
public class DeleteTaller1PDSData {
	public void deleteTestData() throws PersistentException {
		PersistentTransaction t = com.pancho.Taller1PDSPersistentManager.instance().getSession().beginTransaction();
		try {
			com.pancho.Pacient lcompanchoPacient = com.pancho.PacientDAO.loadPacientByQuery(null, null);
			// Delete the persistent object
			com.pancho.PacientDAO.delete(lcompanchoPacient);
			com.pancho.User lcompanchoUser = com.pancho.UserDAO.loadUserByQuery(null, null);
			// Delete the persistent object
			com.pancho.UserDAO.delete(lcompanchoUser);
			com.pancho.Doctor lcompanchoDoctor = com.pancho.DoctorDAO.loadDoctorByQuery(null, null);
			// Delete the persistent object
			com.pancho.DoctorDAO.delete(lcompanchoDoctor);
			com.pancho.BabyMonitor lcompanchoBabyMonitor = com.pancho.BabyMonitorDAO.loadBabyMonitorByQuery(null, null);
			// Delete the persistent object
			com.pancho.BabyMonitorDAO.delete(lcompanchoBabyMonitor);
			com.pancho.Solution lcompanchoSolution = com.pancho.SolutionDAO.loadSolutionByQuery(null, null);
			// Delete the persistent object
			com.pancho.SolutionDAO.delete(lcompanchoSolution);
			com.pancho.Diagnose lcompanchoDiagnose = com.pancho.DiagnoseDAO.loadDiagnoseByQuery(null, null);
			// Delete the persistent object
			com.pancho.DiagnoseDAO.delete(lcompanchoDiagnose);
			com.pancho.Response lcompanchoResponse = com.pancho.ResponseDAO.loadResponseByQuery(null, null);
			// Delete the persistent object
			com.pancho.ResponseDAO.delete(lcompanchoResponse);
			com.pancho.Question lcompanchoQuestion = com.pancho.QuestionDAO.loadQuestionByQuery(null, null);
			// Delete the persistent object
			com.pancho.QuestionDAO.delete(lcompanchoQuestion);
			com.pancho.QuestForm lcompanchoQuestForm = com.pancho.QuestFormDAO.loadQuestFormByQuery(null, null);
			// Delete the persistent object
			com.pancho.QuestFormDAO.delete(lcompanchoQuestForm);
			t.commit();
		}
		catch (Exception e) {
			t.rollback();
		}
		
	}
	
	public static void main(String[] args) {
		try {
			DeleteTaller1PDSData deleteTaller1PDSData = new DeleteTaller1PDSData();
			try {
				deleteTaller1PDSData.deleteTestData();
			}
			finally {
				com.pancho.Taller1PDSPersistentManager.instance().disposePersistentManager();
			}
		}
		catch (Exception e) {
			e.printStackTrace();
		}
	}
}
